//
//  EntrustPictureTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/14.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "EntrustPictureTableViewCell.h"

@interface EntrustPictureTableViewCell ()
@property (nonatomic,strong)GLGWImageView * pictureImageView;

@end

@implementation EntrustPictureTableViewCell{
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWLabel * upLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(20), KScreenWidth - kWidthProportion_In_iPhoneTriploid(30), kHeightProportion_In_iPhoneTriploid(22)) theFont:BOLDSYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:self];
        upLabel.text = @"您可以上传所需货品的照片";
        //
        self.pictureImageView = [[GLGWImageView alloc] initWithImageName:@"" inSuperView:self.contentView];
        self.pictureImageView.backgroundColor = kRandomColor;
        [self.pictureImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(62));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(80)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(80)));
        }];
        //手势
        UITapGestureRecognizer * tap_nav = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap_PicAction:)];
        tap_nav.numberOfTouchesRequired = 1;
        tap_nav.numberOfTapsRequired = 1;
        [self.pictureImageView addGestureRecognizer:tap_nav];
        self.pictureImageView.userInteractionEnabled = YES;
        //
        GLGWView * lineView = [[GLGWView alloc]  initWithInSuperView:self.contentView];
        lineView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView).offset(0);
            make.top.equalTo(self.pictureImageView.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(30));
            make.height.equalTo(@1);
        }];
        //
        GLGWLabel * orLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self.contentView];
        orLabel.text = @"或者";
        orLabel.textAlignment = NSTextAlignmentCenter;
        orLabel.backgroundColor = [UIColor whiteColor];
        [orLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self.pictureImageView.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(70)));
        }];
        //
        GLGWLabel * editLabel = [[GLGWLabel alloc] initWithFont:BOLDSYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:self.contentView];
        editLabel.text = @"填写信息";
        [editLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(orLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
    }
    return self;
}

-(void)tap_PicAction:(UITapGestureRecognizer *)tap{
    GLGWImageView * imageView = (GLGWImageView *)tap.view;
    imageView.backgroundColor = kRandomColor;
    if (self.Block_ImageView) {
        self.Block_ImageView(imageView);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
